package cn.tedu.imop.stock.service.impl;

import cn.tedu.imop.stock.dao.repository.CouponStockRepository;
import cn.tedu.imop.stock.entity.CouponStock;
import cn.tedu.imop.stock.service.CouponStockService;
import org.springframework.stereotype.Service;

@Service
public class CouponStockServiceImpl implements CouponStockService {
    private CouponStockRepository couponStockRepository;
    public CouponStockServiceImpl(CouponStockRepository couponStockRepository) {
        this.couponStockRepository = couponStockRepository;
    }
    @Override
    public Boolean createCouponStock(CouponStock stock) {
        return couponStockRepository.insertCouponStock(stock)>0;
    }

    @Override
    public CouponStock getCouponStock(Integer couponId) {
        return couponStockRepository.selectCouponStock(couponId);
    }

    @Override
    public Boolean editNumByCouponId(Integer couponId) {
        return couponStockRepository.updateNumByCouponId(couponId)>0;
    }
}
